package com.sky.mapper;

import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {
    //根据菜品id查询套餐id
    List<Long> getSetmealIdsByDishIds(List<Long> dishIds);

    //批量插入菜品数据
    void insertBatch(List<SetmealDish> setmealDishes);

    //根据套餐id集合批量删除关联的口味数据
    void deleteBySetmealIds(List<Long> setmealIds);

    //根据套餐id查询口味数据
    @Select("SELECT *FROM setmeal_dish where setmeal_id=#{setmealId}")
    List<SetmealDish> getByDishId(Long id);

    //根据套餐id删除菜品数据
    @Delete("delete from dish_flavor where dish_id=#{dishId}")
    void deleteByDishId(Long id);
}
